<?php
$v_status = -1;
$v_filter = "";
if(isset($_REQUEST['hdn_filter'])){
	$v_filter=_replace_bad_char(trim($_REQUEST['hdn_filter']));
}
$v_recordtype_id = "";
if(isset($_REQUEST['hdn_recordtype_id'])){
	$v_recordtype_id=$_REQUEST['hdn_recordtype_id'];
}
if(isset($_REQUEST['offset'])){
	$v_offset=$_REQUEST['offset'];
}
else
	$v_offset=1;
$v_limit = 10;

if(isset($_REQUEST['page'])){
	$page=$_REQUEST['page'];
}
else
	$page=1;
	
if(_is_sqlserver()){

	$cmd = @mssql_init("Onegate_ReportTypeCountAll", $conn);
	@mssql_bind($cmd, "@p_filter", $v_filter, SQLVARCHAR);
	@mssql_bind($cmd, "@p_recordtype_id", $v_recordtype_id, SQLVARCHAR);
	$result = mssql_execute($cmd); 
	$arr_result = _get_row_to_array($result);
	@mssql_free_result($result);
	$v_total = $arr_result['0']['0'];
	$pager  = Pager::getPagerData($v_total, $v_limit, $page);
	$page   = $pager->page;
  	$offset = $pager->offset +1; 
  	$limit = $pager->limit;

	$cmd = @mssql_init("Onegate_ReportTypeGetAll", $conn);
	@mssql_bind($cmd, "@p_filter", $v_filter, SQLVARCHAR);
	@mssql_bind($cmd,"@offset", $offset,SQLINT4);	
	@mssql_bind($cmd,"@limit",$limit,SQLINT4);
	@mssql_bind($cmd, "@p_recordtype_id", $v_recordtype_id, SQLVARCHAR);
	
	$result = mssql_execute($cmd); 
	//$arr_all_report = _get_row_to_array($result);
	//@mssql_next_result($result);
	$arr_report = _get_row_to_array($result); 
	@mssql_free_result($result);
	
}?>
